<template>
    <div>
        <h1>动态组件</h1>
        <div>
            <keep-alive>
                <component :is="currentComponent"></component>
            </keep-alive>
            <button @click="currentComponent = 'InputElement'">切换input</button>
            <button @click="currentComponent = 'RadioElement'">切换radio</button>
        </div>
    </div>
</template>
<script>
import InputElement from '@/components/InputElement.vue';
import RadioElement from '@/components/RadioElement.vue';
export default{
    components:{
        InputElement,RadioElement
    },
    data(){
        return {
            currentComponent:"InputElement"
        }
    }
}
</script>